﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace fCloud.SensorApi.Migrations
{
    /// <inheritdoc />
    public partial class InitialCreate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "sensordatas",
                columns: table => new
                {
                    id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    sensor_sn = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    device_code = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    device_name = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    create_time = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    temper = table.Column<double>(type: "double", nullable: false),
                    dens = table.Column<double>(type: "double", nullable: false),
                    vis = table.Column<double>(type: "double", nullable: false),
                    vis40 = table.Column<double>(type: "double", nullable: false),
                    diel = table.Column<double>(type: "double", nullable: false),
                    ppm = table.Column<double>(type: "double", nullable: false),
                    aw = table.Column<double>(type: "double", nullable: false),
                    mo = table.Column<double>(type: "double", nullable: false),
                    par1 = table.Column<double>(type: "double", nullable: false),
                    par2 = table.Column<double>(type: "double", nullable: false),
                    par3 = table.Column<double>(type: "double", nullable: false),
                    par4 = table.Column<double>(type: "double", nullable: false),
                    par5 = table.Column<double>(type: "double", nullable: false),
                    par6 = table.Column<double>(type: "double", nullable: false),
                    par7 = table.Column<double>(type: "double", nullable: false),
                    par8 = table.Column<double>(type: "double", nullable: false),
                    class1 = table.Column<double>(type: "double", nullable: false),
                    class2 = table.Column<double>(type: "double", nullable: false),
                    class3 = table.Column<double>(type: "double", nullable: false),
                    class4 = table.Column<double>(type: "double", nullable: false),
                    class5 = table.Column<double>(type: "double", nullable: false),
                    class6 = table.Column<double>(type: "double", nullable: false),
                    class_total = table.Column<double>(type: "double", nullable: false),
                    standard = table.Column<double>(type: "double", nullable: false),
                    fe1 = table.Column<double>(type: "double", nullable: false),
                    fe2 = table.Column<double>(type: "double", nullable: false),
                    fe3 = table.Column<double>(type: "double", nullable: false),
                    fe4 = table.Column<double>(type: "double", nullable: false),
                    fe5 = table.Column<double>(type: "double", nullable: false),
                    fe6 = table.Column<double>(type: "double", nullable: false),
                    fe7 = table.Column<double>(type: "double", nullable: false),
                    fe8 = table.Column<double>(type: "double", nullable: false),
                    nfe1 = table.Column<double>(type: "double", nullable: false),
                    nfe2 = table.Column<double>(type: "double", nullable: false),
                    nfe3 = table.Column<double>(type: "double", nullable: false),
                    nfe4 = table.Column<double>(type: "double", nullable: false),
                    nfe5 = table.Column<double>(type: "double", nullable: false),
                    fe = table.Column<double>(type: "double", nullable: false),
                    nfe = table.Column<double>(type: "double", nullable: false),
                    state = table.Column<double>(type: "double", nullable: false),
                    press = table.Column<double>(type: "double", nullable: false),
                    speed = table.Column<double>(type: "double", nullable: false),
                    buffer_temper = table.Column<double>(type: "double", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sensordatas", x => x.id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "sensors",
                columns: table => new
                {
                    id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    sensor_code = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    sensor_name = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    sensor_sn = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    gateway_id = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    sensor_type = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    sensor_mode = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    sensor_topic = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    sensor_subscribe = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    flag = table.Column<int>(type: "int", nullable: false),
                    online_status = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_sensors", x => x.id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "sensordatas");

            migrationBuilder.DropTable(
                name: "sensors");
        }
    }
}
